package com.wootion.cims.module.systemsetting.system.service.impl;

import com.wootion.cims.dao.SysConfigurationDao;
import com.wootion.cims.dao.SysLogDao;
import com.wootion.cims.general.enumtype.Security;
import com.wootion.cims.general.utils.GetIp;
import com.wootion.cims.module.systemsetting.log.model.SysLog;
import com.wootion.cims.module.systemsetting.system.model.SysConfiguration;
import com.wootion.cims.module.systemsetting.user.model.User;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wootion.cims.dao.SysInformationDao;
import com.wootion.cims.module.systemsetting.system.model.SysInformation;
import com.wootion.cims.module.systemsetting.system.service.SysInformationService;
import com.wootion.cims.module.systemsetting.system.dto.SysInformationDto;
import com.wootion.cims.response.ResponseResult;
import com.wootion.cims.response.ResultCode;
import com.wootion.cims.shiro.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import java.util.Objects;

/**
 * @Author: LanQiang
 * @Date: 2022/11/23/11:23
 * @Description: 作用xxx
 */
@Service
@Slf4j
public class SysInformationServiceImpl extends ServiceImpl<SysInformationDao, SysInformation> implements SysInformationService {

    @Resource
    private SysInformationDao sysInformationDao;

    @Resource
    private SysConfigurationDao sysConfigurationDao;

    @Resource
    private SysLogDao sysLogDao;

    /**
     * 保存自定义设置
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ResponseResult saveSysInformation(HttpServletRequest request,SysInformationDto sysInformationDto) throws IOException, SQLException {
        SysLog sysLog = new SysLog();
        sysLog.setIncident("系统配置");
        sysLog.setType("修改");
        sysLog.setValue("系统日志");
        sysLog.setCreateTime(new Date());
        sysLog.setIp(GetIp.getIpAddr(request));
        User user3 = (User) ShiroUtils.getSubject().getPrincipal();
        sysLog.setOperator(user3.getUsername());
        sysLog.setContent("修改配置");
        StringBuilder builder = new StringBuilder();

        MultipartFile multipartFile = sysInformationDto.getImage();
        SysInformation sysInformation = null;

        //修改系统配置项
        String passwordUpper = sysInformationDto.getPasswordUpper();//密码长度上限
        String passwordLower = sysInformationDto.getPasswordLower();//密码长度下限
        String characterCombination = sysInformationDto.getCharacterCombination();//字符组合
        String passwordTipsCycle = sysInformationDto.getPasswordTipsCycle();//密码提示周期
        String passwordTipsType = sysInformationDto.getPasswordTipsType();//修改密码提示方式
        String fewMinutes = sysInformationDto.getFewMinutes();//几分钟之内
        String errorsNumber = sysInformationDto.getErrorsNumber();//错误的次数
        String unlockMinutes = sysInformationDto.getUnlockMinutes();//几分钟后自动解锁
        String passwordCycleType = sysInformationDto.getPasswordCycleType();//密码周期是自定义的还是默认的
        //修改密码长度上限
        LambdaQueryWrapper<SysConfiguration> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysConfiguration::getCode,Security.PASSWORD_UPPER.getCode());
        SysConfiguration sysConfiguration = sysConfigurationDao.selectOne(queryWrapper);
        if(Objects.nonNull(sysConfiguration)){
            if(!passwordUpper.equals(sysConfiguration.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration,sysConfiguration1,"value");
                sysConfiguration1.setValue(passwordUpper);
                sysConfigurationDao.updateById(sysConfiguration1);

                builder.append("密码长度上限被修改,修改前:")
                        .append(sysConfiguration.getValue())
                        .append("位")
                        .append(",修改后:")
                        .append(passwordUpper)
                        .append("位。");
            }
        }

        //修改密码长度下限
        LambdaQueryWrapper<SysConfiguration> queryWrapper2 = new LambdaQueryWrapper<>();
        queryWrapper2.eq(SysConfiguration::getCode,Security.PASSWORD_LOWER.getCode());
        SysConfiguration sysConfiguration2 = sysConfigurationDao.selectOne(queryWrapper2);
        if(Objects.nonNull(sysConfiguration2)){
            if(!passwordLower.equals(sysConfiguration2.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration2,sysConfiguration1,"value");
                sysConfiguration1.setValue(passwordLower);
                sysConfigurationDao.updateById(sysConfiguration1);

                builder.append("密码长度下限被修改,修改前:")
                        .append(sysConfiguration2.getValue())
                        .append("位")
                        .append(",修改后:")
                        .append(passwordLower)
                        .append("位。");
            }
        }
        //修改字符组合
        LambdaQueryWrapper<SysConfiguration> queryWrapper3 = new LambdaQueryWrapper<>();
        queryWrapper3.eq(SysConfiguration::getCode,Security.CHARACTER_COMBINATION.getCode());
        SysConfiguration sysConfiguration3 = sysConfigurationDao.selectOne(queryWrapper3);
        if(Objects.nonNull(sysConfiguration3)){
            if(!characterCombination.equals(sysConfiguration3.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration3,sysConfiguration1,"value");
                sysConfiguration1.setValue(characterCombination);
                sysConfigurationDao.updateById(sysConfiguration1);

                builder.append("字符组合被修改,修改前:{");
                String value = sysConfiguration3.getValue();
                if(value.contains("number")){
                    builder.append("数字 ");
                }
                if(value.contains("uppercase")){
                    builder.append("大写字母 ");
                }
                if(value.contains("lowercase")){
                    builder.append("小写字母 ");
                }
                if(value.contains("symbol")){
                    builder.append("符号 ");
                }
                builder.append("}")
                        .append(",修改后:{");

                if(characterCombination.contains("number")){
                    builder.append("数字 ");
                }
                if(characterCombination.contains("uppercase")){
                    builder.append("大写字母 ");
                }
                if(characterCombination.contains("lowercase")){
                    builder.append("小写字母 ");
                }
                if(characterCombination.contains("symbol")){
                    builder.append("符号");
                }
                builder.append("}。");
            }
        }

        //修改密码提示周期(单位月)
        LambdaQueryWrapper<SysConfiguration> queryWrapper4 = new LambdaQueryWrapper<>();
        queryWrapper4.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_CYCLE.getCode());
        SysConfiguration sysConfiguration4 = sysConfigurationDao.selectOne(queryWrapper4);
        if(Objects.nonNull(sysConfiguration4)){
            if(!passwordTipsCycle.equals(sysConfiguration4.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration4,sysConfiguration1,"value");
                sysConfiguration1.setValue(passwordTipsCycle);
                if(passwordCycleType.equals("true")){
                    //自定义的
                    sysConfiguration1.setPasswordCycleType(true);
                }
                if(passwordCycleType.equals("false")){
                    //默认的
                    sysConfiguration1.setPasswordCycleType(false);
                }
                sysConfigurationDao.updateById(sysConfiguration1);
                builder.append("密码提示周期被修改,修改前:")
                        .append(sysConfiguration4.getValue())
                        .append("个月")
                        .append(",修改后:")
                        .append(passwordTipsCycle)
                        .append("个月。");
            }
        }

        //修改密码提示方式
        LambdaQueryWrapper<SysConfiguration> queryWrapper5 = new LambdaQueryWrapper<>();
        queryWrapper5.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_TYPE.getCode());
        SysConfiguration sysConfiguration5 = sysConfigurationDao.selectOne(queryWrapper5);
        if(Objects.nonNull(sysConfiguration5)){
            if(!passwordTipsType.equals(sysConfiguration5.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration5,sysConfiguration1,"value");
                sysConfiguration1.setValue(passwordTipsType);
                sysConfigurationDao.updateById(sysConfiguration1);
                builder.append("密码提示方式被修改,修改前:");
                if(sysConfiguration5.getValue().equals("everytime")){
                    builder.append("每次登陆提示。");
                }
                if(sysConfiguration5.getValue().equals("onlyone")){
                    builder.append("到期仅提示一次。");
                }
                builder.append(",被修改后:");
                if(passwordTipsType.equals("everytime")){
                    builder.append("每次登陆提示。");
                }
                if(passwordTipsType.equals("onlyone")){
                    builder.append("到期仅提示一次。");
                }
            }
        }

        //几分钟之内
        LambdaQueryWrapper<SysConfiguration> queryWrapper6 = new LambdaQueryWrapper<>();
        queryWrapper6.eq(SysConfiguration::getCode,Security.FEW_MINUTES.getCode());
        SysConfiguration sysConfiguration6 = sysConfigurationDao.selectOne(queryWrapper6);
        if(Objects.nonNull(sysConfiguration6)){
            if(!fewMinutes.equals(sysConfiguration6.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration6,sysConfiguration1,"value");
                sysConfiguration1.setValue(fewMinutes);
                sysConfigurationDao.updateById(sysConfiguration1);
//                builder.append("登录失败锁定规则被修改,修改前:")
//                        .append(sysConfiguration6.getValue())
//                        .append("分钟之内")
//                        .append(",修改后:")
//                        .append(fewMinutes)
//                        .append("分钟之内。");
            }
        }

        //错误的次数
        LambdaQueryWrapper<SysConfiguration> queryWrapper7 = new LambdaQueryWrapper<>();
        queryWrapper7.eq(SysConfiguration::getCode,Security.ERRORS_NUMBER.getCode());
        SysConfiguration sysConfiguration7 = sysConfigurationDao.selectOne(queryWrapper7);
        if(Objects.nonNull(sysConfiguration7)){
            if(!errorsNumber.equals(sysConfiguration7.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration7,sysConfiguration1,"value");
                sysConfiguration1.setValue(errorsNumber);
                sysConfigurationDao.updateById(sysConfiguration1);
//                builder.append("输入错误密码次数被修改,修改前:")
//                        .append(sysConfiguration7.getValue())
//                        .append("次")
//                        .append(",修改后:")
//                        .append(errorsNumber)
//                        .append("次。");
            }
        }

        //几分钟后自动解锁
        LambdaQueryWrapper<SysConfiguration> queryWrapper8 = new LambdaQueryWrapper<>();
        queryWrapper8.eq(SysConfiguration::getCode,Security.UNLOCK_MINUTES.getCode());
        SysConfiguration sysConfiguration8 = sysConfigurationDao.selectOne(queryWrapper8);
        if(Objects.nonNull(sysConfiguration8)){
            if(!unlockMinutes.equals(sysConfiguration8.getValue())){
                SysConfiguration sysConfiguration1 = new SysConfiguration();
                BeanUtils.copyProperties(sysConfiguration8,sysConfiguration1,"value");
                sysConfiguration1.setValue(unlockMinutes);
                sysConfigurationDao.updateById(sysConfiguration1);
//                builder.append("修改系统解锁时间,修改前:")
//                        .append(sysConfiguration8.getValue())
//                        .append("之后解锁")
//                        .append(",修改后:")
//                        .append(unlockMinutes)
//                        .append("之后解锁。");
            }
        }
        Boolean coverSetting = sysInformationDto.getCoverSetting();
        if(coverSetting.equals(false)){
            LambdaQueryWrapper<SysInformation> queryWrapper12 = new LambdaQueryWrapper<>();
            queryWrapper12.eq(SysInformation::getActivation,true);
            SysInformation sysInformation12 = sysInformationDao.selectOne(queryWrapper12);
            if(sysInformation12.getCoverSetting().equals(true)){
                builder.append("修改系统封面从自定义改为默认。");
            }
            log.info("开始修改默认图片设置");
            sysInformationDao.updateActivation();
            LambdaQueryWrapper<SysInformation> wrapper2 = new LambdaQueryWrapper<>();
            wrapper2.eq(SysInformation::getCoverSetting,false);
            SysInformation sysInformation1 = sysInformationDao.selectOne(wrapper2);
            sysInformation1.setActivation(true);
            sysInformation1.setSysName(sysInformationDto.getSysName());
            if(!sysInformation1.getSysName().equals(sysInformationDto.getSysName())){
                builder.append("修改系统名称,修改前")
                        .append(sysInformation1.getSysName())
                        .append(",修改后:")
                        .append(sysInformationDto.getSysName())
                        .append("。");
            }
            sysInformation1.setCoverSetting(false);
            sysInformation1.setOldAge(sysInformationDto.getOldAge());
            if(sysInformation1.getOldAge().intValue() != sysInformationDto.getOldAge().intValue()){
                builder.append("修改系统中老年人年龄,修改前")
                        .append(sysInformation1.getOldAge())
                        .append(",修改后:")
                        .append(sysInformationDto.getOldAge())
                        .append("。");
            }
            sysInformation1.setImage(sysInformationDto.getImage().getBytes());
            sysInformation1.setPictureSize(sysInformationDto.getPictureSize());
            sysInformation1.setUpdateTime(new Date());
            User user2 = (User) ShiroUtils.getSubject().getPrincipal();
            sysInformation1.setUpdateUserid(user2.getId());
            int rows = sysInformationDao.updateById(sysInformation1);
            sysLog.setDetails(builder.toString());
            if(rows>0){
                sysLog.setResult("成功");
            }else {
                sysLog.setResult("失败");
            }
            int insert = sysLogDao.insert(sysLog);
            if(insert>0){
                log.info("系统设置日志记录成功");
            }else {
                log.error("系统设置日志记录失败");
            }
            return ResponseResult.builder().build();
        }
        if (!Objects.isNull(multipartFile)) {
            LambdaQueryWrapper<SysInformation> queryWrapper12 = new LambdaQueryWrapper<>();
            queryWrapper12.eq(SysInformation::getActivation,true);
            SysInformation sysInformation12 = sysInformationDao.selectOne(queryWrapper12);
            if(sysInformation12.getCoverSetting().equals(true)){
                builder.append("修改系统封面从自定义改为自定义。");
            }else{
                builder.append("修改系统封面从默认改为自定义。");
            }

            log.info("接收的图片成功！，开始转为二进制流");
            byte[] bytes = multipartFile.getBytes();

            sysInformation = new SysInformation();
            sysInformation.setImage(bytes);//图片二进制流
            sysInformation.setOldAge(sysInformationDto.getOldAge());//设置老年人年龄
            if(sysInformation12.getOldAge().intValue() != sysInformationDto.getOldAge().intValue()){
                builder.append("修改系统中老年人年龄,修改前:")
                        .append(sysInformation12.getOldAge())
                        .append(",修改后:")
                        .append(sysInformationDto.getOldAge())
                        .append("。");
            }
            sysInformation.setSysName(sysInformationDto.getSysName());//设置系统名称
            if(!sysInformation12.getSysName().equals(sysInformationDto.getSysName())){
                builder.append("修改系统名称,修改前:")
                        .append(sysInformation12.getSysName())
                        .append(",修改后:")
                        .append(sysInformationDto.getSysName())
                        .append("。");
            }
            sysInformation.setCoverSetting(sysInformationDto.getCoverSetting());//设置默认/自定义
            sysInformation.setPictureSize(sysInformationDto.getPictureSize());//设置图片大小
            sysInformation.setCreateTime(new Date());//设置创建时间
            sysInformation.setActivation(true);//设置为激活状态
            User user = (User) ShiroUtils.getSubject().getPrincipal();
            sysInformation.setCreateUserid(user.getId());//设置创建人id
            int rows1 = sysInformationDao.updateActivation();//先将全部的主题设置为未激活
            if (rows1 > 0) {
                sysInformationDao.deleteByCoverSetting();
                int rows = sysInformationDao.insert(sysInformation);//刚新增的这条主题即为以后要使用的主题
                sysLog.setDetails(builder.toString());
                if(rows>0){
                    sysLog.setResult("成功");
                }else {
                    sysLog.setResult("失败");
                }
                int insert = sysLogDao.insert(sysLog);
                if(insert>0){
                    log.info("系统设置日志记录成功");
                }else {
                    log.error("系统设置日志记录失败");
                }
                return rows > 0 ? ResponseResult.builder().build() : ResponseResult.builder().code(ResultCode.SYSTEM_ERROR.getCode()).message(ResultCode.SYSTEM_ERROR.getMessage()).build();
            }
            return ResponseResult.builder().code(ResultCode.PARAM_IS_BLANK.getCode()).message(ResultCode.PARAM_IS_BLANK.getMessage()).build();
        }
        return ResponseResult.builder().code(ResultCode.PARAM_IS_BLANK.getCode()).message(ResultCode.PARAM_IS_BLANK.getMessage()).build();
    }

    /**
     * 获取登陆时的自定义设置
     *
     * @return
     */
    @Override
    public ResponseResult findTopicSysInformation() {
        LambdaQueryWrapper<SysInformation> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysInformation::getActivation, true);
        SysInformation sysInformation = sysInformationDao.selectOne(wrapper);
        //查询系统安全配置一并返回给前端
        LambdaQueryWrapper<SysConfiguration> queryWrapper1 = new LambdaQueryWrapper<>();
        queryWrapper1.eq(SysConfiguration::getCode,Security.PASSWORD_LOWER.getCode());
        SysConfiguration sysConfiguration = sysConfigurationDao.selectOne(queryWrapper1);
        sysInformation.setPasswordLower(sysConfiguration.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper2 = new LambdaQueryWrapper<>();
        queryWrapper2.eq(SysConfiguration::getCode,Security.PASSWORD_UPPER.getCode());
        SysConfiguration sysConfiguration2 = sysConfigurationDao.selectOne(queryWrapper2);
        sysInformation.setPasswordUpper(sysConfiguration2.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper3 = new LambdaQueryWrapper<>();
        queryWrapper3.eq(SysConfiguration::getCode,Security.CHARACTER_COMBINATION.getCode());
        SysConfiguration sysConfiguration3 = sysConfigurationDao.selectOne(queryWrapper3);
        sysInformation.setCharacterCombination(sysConfiguration3.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper4 = new LambdaQueryWrapper<>();
        queryWrapper4.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_CYCLE.getCode());
        SysConfiguration sysConfiguration4 = sysConfigurationDao.selectOne(queryWrapper4);
        sysInformation.setPasswordTipsCycle(sysConfiguration4.getValue());
        if(sysConfiguration4.getPasswordCycleType().equals(true)){
            sysInformation.setPasswordCycleType("true");
        }
        if(sysConfiguration4.getPasswordCycleType().equals(false)){
            sysInformation.setPasswordCycleType("false");
        }

        LambdaQueryWrapper<SysConfiguration> queryWrapper5= new LambdaQueryWrapper<>();
        queryWrapper5.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_TYPE.getCode());
        SysConfiguration sysConfiguration5 = sysConfigurationDao.selectOne(queryWrapper5);
        sysInformation.setPasswordTipsType(sysConfiguration5.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper6= new LambdaQueryWrapper<>();
        queryWrapper6.eq(SysConfiguration::getCode,Security.FEW_MINUTES.getCode());
        SysConfiguration sysConfiguration6 = sysConfigurationDao.selectOne(queryWrapper6);
        sysInformation.setFewMinutes(sysConfiguration6.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper7= new LambdaQueryWrapper<>();
        queryWrapper7.eq(SysConfiguration::getCode,Security.ERRORS_NUMBER.getCode());
        SysConfiguration sysConfiguration7 = sysConfigurationDao.selectOne(queryWrapper7);
        sysInformation.setErrorsNumber(sysConfiguration7.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper8= new LambdaQueryWrapper<>();
        queryWrapper8.eq(SysConfiguration::getCode,Security.UNLOCK_MINUTES.getCode());
        SysConfiguration sysConfiguration8 = sysConfigurationDao.selectOne(queryWrapper8);
        sysInformation.setUnlockMinutes(sysConfiguration8.getValue());

        return ResponseResult.builder().data(sysInformation).build();
    }

    /**
     * 获取默认设置
     *
     * @return
     */
    @Override
    public ResponseResult findTopicDefaultImageSysInformation(SysInformation sysInformation) {
        LambdaQueryWrapper<SysInformation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(SysInformation::getCoverSetting, sysInformation.getCoverSetting());
        SysInformation sysInformation2 = sysInformationDao.selectOne(lambdaQueryWrapper);


        //查询系统安全配置一并返回给前端
        LambdaQueryWrapper<SysConfiguration> queryWrapper1 = new LambdaQueryWrapper<>();
        queryWrapper1.eq(SysConfiguration::getCode,Security.PASSWORD_LOWER.getCode());
        SysConfiguration sysConfiguration = sysConfigurationDao.selectOne(queryWrapper1);
        sysInformation2.setPasswordLower(sysConfiguration.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper2 = new LambdaQueryWrapper<>();
        queryWrapper2.eq(SysConfiguration::getCode,Security.PASSWORD_UPPER.getCode());
        SysConfiguration sysConfiguration2 = sysConfigurationDao.selectOne(queryWrapper2);
        sysInformation2.setPasswordUpper(sysConfiguration2.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper3 = new LambdaQueryWrapper<>();
        queryWrapper3.eq(SysConfiguration::getCode,Security.CHARACTER_COMBINATION.getCode());
        SysConfiguration sysConfiguration3 = sysConfigurationDao.selectOne(queryWrapper3);
        sysInformation2.setCharacterCombination(sysConfiguration3.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper4 = new LambdaQueryWrapper<>();
        queryWrapper4.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_CYCLE.getCode());
        SysConfiguration sysConfiguration4 = sysConfigurationDao.selectOne(queryWrapper4);
        sysInformation2.setPasswordTipsCycle(sysConfiguration4.getValue());
        if(sysConfiguration4.getPasswordCycleType().equals(true)){
            sysInformation2.setPasswordCycleType("true");
        }
        if(sysConfiguration4.getPasswordCycleType().equals(false)){
            sysInformation2.setPasswordCycleType("false");
        }

        LambdaQueryWrapper<SysConfiguration> queryWrapper5= new LambdaQueryWrapper<>();
        queryWrapper5.eq(SysConfiguration::getCode,Security.PASSWORD_TIPS_TYPE.getCode());
        SysConfiguration sysConfiguration5 = sysConfigurationDao.selectOne(queryWrapper5);
        sysInformation2.setPasswordTipsType(sysConfiguration5.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper6= new LambdaQueryWrapper<>();
        queryWrapper6.eq(SysConfiguration::getCode,Security.FEW_MINUTES.getCode());
        SysConfiguration sysConfiguration6 = sysConfigurationDao.selectOne(queryWrapper6);
        sysInformation2.setFewMinutes(sysConfiguration6.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper7= new LambdaQueryWrapper<>();
        queryWrapper7.eq(SysConfiguration::getCode,Security.ERRORS_NUMBER.getCode());
        SysConfiguration sysConfiguration7 = sysConfigurationDao.selectOne(queryWrapper7);
        sysInformation2.setErrorsNumber(sysConfiguration7.getValue());

        LambdaQueryWrapper<SysConfiguration> queryWrapper8= new LambdaQueryWrapper<>();
        queryWrapper8.eq(SysConfiguration::getCode,Security.UNLOCK_MINUTES.getCode());
        SysConfiguration sysConfiguration8 = sysConfigurationDao.selectOne(queryWrapper8);
        sysInformation2.setUnlockMinutes(sysConfiguration8.getValue());
        return  ResponseResult.builder().data(sysInformation2).build();
    }
}
